<?php

namespace app\controller;

use app\BaseController;
use think\facade\Route;
use think\facade\Session;
use think\facade\View;
use think\response\Redirect;

class Index extends BaseController
{
    /**
     * 首页，后台主框架
     * @return \think\response\View
     */
    public function index()
    {
        $adminName = $this->getCurrentUserName();
        return \view('', ['adminName' => $adminName]);
    }

    /**
     * 欢迎页
     * @return View|\think\response\View
     */
    public function welcome()
    {
        $adminName = $this->getCurrentUserName();
        return \view('', ['adminName' => $adminName]);
    }

    /**
     * 退出登录
     * @return Redirect
     */
    public function logout(): Redirect
    {
        Session::delete('uid');
        return redirect(Route::buildUrl('admin/login/index')->__toString());
    }

}
